package com.fzshang.shopping.api.controller;

import com.fzshang.shopping.commen.bean.Redis;
import com.fzshang.shopping.commen.controller.BaseController;
import com.fzshang.shopping.commen.entity.ApiResult;
import com.fzshang.shopping.commen.service.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @AUTHOR 冯政尚
 * @DATE 2020/4/13 11:35
 * @DAY_NAME_FULL: 星期一
 */
@Controller
@RequestMapping(value = "/redis")
public class RedisController extends BaseController {

    @RequestMapping(value = "insert")
    @ResponseBody
    public ApiResult insert(){
        Redis redis=new Redis();
        redis.setUser("哈哈哈");
        redis.setPassword("123456");
        redisService.set("shuju1",redis);
        return ApiResult.ok();
    }

    @RequestMapping(value = "getRedis")
    @ResponseBody
    public ApiResult getRedis(){
        return ApiResult.ok(redisService.get("哈哈哈"));
    }


}
